<template>
<div class="userbg">
<div class="kg-head-he"></div>
<header class="kg-head reg-top">
	<div class="dqxz" @click="back"><i class="micon">&#xe61e;</i></div>
	<div class="search_box show-cansu">
		我的
	</div>
</header>
<div class="kg-indextop">
	<div class="kg-indextopimg"><img :src="user.avatar_url"/></div>
	<p>{{user.nick_name}}</p><p>{{user.grade_code}}</p>
</div>
<!---->
<div class="kg-navbox h_flex">
	<router-link to="/profile" class="kg-navli">
		<div class="kg-navli-icon"><i class="micon">&#xe7ea;</i></div>
		<div class="kg-navli-text">我的资料</div>
	</router-link>
	
	<router-link to="/signList" class="kg-navli">
		<div class="kg-navli-icon"><i class="micon">&#xe604;</i></div>
		<div class="kg-navli-text">我的报名</div>
	</router-link>
	
	<router-link to="/grading" class="kg-navli">
		<div class="kg-navli-icon"><i class="micon">&#xe610;</i></div>
		<div class="kg-navli-text">我的考级</div>
	</router-link>
	
	<router-link to="/cert" class="kg-navli">
		<div class="kg-navli-icon"><i class="micon">&#xe606;</i></div>
		<div class="kg-navli-text">我的证书</div>
	</router-link>
	
	<router-link to="/notice?id=10006" class="kg-navli">
		<div class="kg-navli-icon"><i class="micon">&#xe64e;</i></div>
		<div class="kg-navli-text">报名须知</div>
	</router-link>
	
	<router-link to="/notice?id=10001" class="kg-navli">
		<div class="kg-navli-icon"><i class="micon">&#xe622;</i></div>
		<div class="kg-navli-text">考级公告</div>
	</router-link>
	
</div>

<div class="xyhyindex-nav">
	<router-link to="/code">考级卡申请<i class="micon">&#xe603;</i></router-link>
	<router-link to="/notice?id=10003">考级/报名操作说明<i class="micon">&#xe603;</i></router-link>
	<router-link to="/notice?id=10007">联系我们<i class="micon">&#xe603;</i></router-link>
</div>

<div class="m_center">
<div class="but-a mt50" @click="logout">退出登录</div>
</div>
</div>
</template>

<script>

import { mapActions } from 'vuex'
import message from 'ant-design-vue/es/message'
import {detail} from '@/api/user/index'
export default {
  name: 'Index',
  data(){
	return{
      isLoading: false,// 正在加载
	  user:{},
	}
  },
  created () {
    this.getUser()
  },
  methods: {
	...mapActions(['Logout']),
	back(){
		this.$router.go(-1)
	},
	getUser() {
		detail().then((res)=>{
			this.user = res.data.userInfo;
			this.gender = this.user.gender=='男'?1:0;
		})
    },
    logout() {
		const { Logout } = this
		
		Logout().then((values)=>{
			message.success(values.message, 1.5)
			setTimeout(() => { 
				// const router = useRouter();
				this.$router.push({ path: '/index' })
			}, 1000)
		})
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.userbg{background: url(@/assets/images/userbg.jpg) top center/100% auto no-repeat #f3f0e9;}
.kg-head-he{display: none;}
.kg-head{ background:none; box-shadow:none; position:relative;}
.kg-navbox{min-height: auto;}
.kg-indextopimg{margin-bottom: 0.266667rem; height: 2.533333rem; border-radius: 0;}
.kg-indextop p{line-height: 0.666667rem;}
</style>
